/**
 * 作者: hxw
 * 日期: 2021-06-07 10:04:59
 * 备注: 弹出公告
 */
package com.motu.monstercity.module.common.utility;

import io.vertx.core.json.JsonObject;

public class NoticeModel {
    protected long id; // 数据库ID
    protected byte type; // 公告类型 (0-游戏内，1-登陆，2-游戏内外都显示)
    protected String title; // 标题
    protected String content1; // 简要内容
    protected String content2; // 详细内容
    protected int startTime; // 开始时间
    protected int endTime; // 结束时间
    protected byte scopeType; // 活动范围类型
    protected String scope; // 活动范围列表
    protected int platform; // 渠道
    protected int sort; // 排序
    protected byte status; // 状态 (1-new，2-hot)
    protected int hashCode; // hash值
    protected String icon; // 图标
    protected String url; // 跳转地址
    protected String urlIcon; // 跳转图标
    protected byte isConstrain; // 是否强制弹出 (0-不强制，1-强制)

    public NoticeModel() {
    }

    public NoticeModel(JsonObject obj) {
        id = obj.containsKey("id") ? obj.getLong("id") : 0;
        type = obj.containsKey("type") ? obj.getInteger("type").byteValue() : 0;
        title = obj.containsKey("title") ? obj.getString("title") : "";
        content1 = obj.containsKey("content1") ? obj.getString("content1") : "";
        content2 = obj.containsKey("content2") ? obj.getString("content2") : "";
        startTime = obj.containsKey("start_time") ? obj.getInteger("start_time") : 0;
        endTime = obj.containsKey("end_time") ? obj.getInteger("end_time") : 0;
        scopeType = obj.containsKey("scope_type") ? obj.getInteger("scope_type").byteValue() : 0;
        scope = obj.containsKey("scope") ? obj.getString("scope") : "";
        platform = obj.containsKey("platform") ? obj.getInteger("platform") : 0;
        sort = obj.containsKey("sort") ? obj.getInteger("sort") : 0;
        status = obj.containsKey("status") ? obj.getInteger("status").byteValue() : 0;
        hashCode = obj.containsKey("hash_code") ? obj.getInteger("hash_code") : 0;
        icon = obj.containsKey("icon") ? obj.getString("icon") : "";
        url = obj.containsKey("url") ? obj.getString("url") : "";
        urlIcon = obj.containsKey("url_icon") ? obj.getString("url_icon") : "";
        isConstrain = obj.containsKey("is_constrain") ? obj.getInteger("is_constrain").byteValue() : 0;
    }

    public long getId() {
        return id;
    }

    public byte getType() {
        return type;
    }

    public String getTitle() {
        return title;
    }

    public String getContent1() {
        return content1;
    }

    public String getContent2() {
        return content2;
    }

    public int getStartTime() {
        return startTime;
    }

    public int getEndTime() {
        return endTime;
    }

    public byte getScopeType() {
        return scopeType;
    }

    public String getScope() {
        return scope;
    }

    public int getPlatform() {
        return platform;
    }

    public int getSort() {
        return sort;
    }

    public byte getStatus() {
        return status;
    }

    public int getHashCode() {
        return hashCode;
    }

    public String getIcon() {
        return icon;
    }

    public String getUrl() {
        return url;
    }

    public String getUrlIcon() {
        return urlIcon;
    }

    public byte getIsConstrain() {
        return isConstrain;
    }

}
